home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 820 b | 49 lines | [TEXT/CWIE] |
- // SimpleProxy.h
-
- #ifndef SimpleProxy_h
- #define SimpleProxy_h
-
- #ifndef Proxy_h
- #include "Proxy.h"
- #endif
- #ifndef Assert_h
- #include "Assert.h"
- #endif
-
- template < class OwnerType, class StoodFor >
- class SimpleProxy: public Proxy< StoodFor >
- {
- typedef OwnerType Owner;
- typedef StoodFor (Owner::*Getter)() const;
- typedef void (Owner::*Setter)( StoodFor ) const;
-
- private:
- const Owner& owner;
- const Getter get;
- const Setter set;
-
- public:
- SimpleProxy( const Owner& theOwner,
- Getter getter,
- Setter setter )
- : owner( theOwner ),
- get( getter ),
- set( setter )
- {
- Assert( getter != 0 );
- Assert( setter != 0 );
- }
-
- virtual StoodFor Get() const
- {
- return (owner.*get)();
- }
-
- virtual void Set( StoodFor value )
- {
- (owner.*set)( value );
- }
- };
-
- #endif
-